<template>
  <div>
    <div class="top">
      <van-icon @click="change" class="arrow-left" name="arrow-left" color="#ccc" size="16px" />
      <span>设置</span>
    </div>
    <ul>
      <li>
        <p>
          <span>选择路线</span>
          <img src="../assets/img/arrow.webp" alt />
        </p>
        <hr />
        <p>
          <span>极速模式</span>
          <van-switch class="switch" v-model="checked" @click="click" size="20px" />
        </p>
      </li>
      <span class="des">开启后，部分动效将被关闭，建议性能较差的用户开启</span>
      <li>
        <p>
          <span>AI智能测距</span>
          <van-switch class="switch" v-model="checked1" @click="click1" size="20px" />
        </p>
        <hr />
        <p>
          <span>护眼模式</span>
          <van-switch class="switch" v-model="checked2" @click="click2" size="20px" />
        </p>
        <hr />
        <p>
          <span>使用时长提醒</span>
          <van-switch class="switch" v-model="checked3" @click="click3" size="20px" />
        </p>
      </li>
      <span class="des">开启后，每持续使用60分钟，会提示休息一下</span>
      <li>
        <p>
          <span>关于我们</span>
          <span style="color: #ccc">
            v3.19.1
            <img src="../assets/img/arrow.webp" alt />
          </span>
        </p>
      </li>
      <van-button class="round" type="primary" round @click="removeToken">退出登录</van-button>
    </ul>
  </div>
</template>

<script>
import { useRouter } from "vue-router";
import { ref } from "vue";

export default {
  setup() {
    const checked = ref(true);
    const checked1 = ref(false);
    const checked2 = ref(true);
    const checked3 = ref(false);
    const click = () => {};
    const click1 = () => {};
    const click2 = () => {};
    const click3 = () => {};
    const router = useRouter();
    const change = () => {
      router.push("/home/mine");
    };
    const removeToken = () => {
      localStorage.removeItem("token");
      localStorage.removeItem("user");
      router.push("/login");
    };
    return {
      change,
      checked,
      checked1,
      checked2,
      checked3,
      click,
      click1,
      click2,
      click3,
      removeToken
    };
  }
};
</script>
<style lang="scss" scoped>
.top {
  .arrow-left {
    float: left;
    font-weight: 600;
    margin-left: 15px;
    margin-top: 15px;
  }
  span {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    font-weight: 500;
    margin-top: 10px;
  }
}
ul {
  height: 607px;
  margin-top: 15px;
  background: #f5f5f5;
  padding: 10px 15px 0;
  li {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #fff;
    padding: 0 10px;
    p {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 14px;
      line-height: 30px;
      span {
        margin-left: 10px;
        font-weight: 600;
      }
      img {
        width: 14px;
        height: 14px;
        margin-right: 10px;
        vertical-align: middle;
      }
      .switch {
        margin-right: 10px;
      }
    }
  }
  .des {
    font-size: 12px;
    font-weight: 400;
    color: #ccc;
    line-height: 30px;
  }
  .round {
    width: 300px;
    margin-top: 20px;
  }
}
</style>
